package com.demo.friend.dao;

import com.demo.friend.pojo.Friend;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by Administrator on 2020/7/20.
 */
public interface FriendDao extends JpaRepository<Friend,String>{
    public Friend findByUseridAndFriendid(String userid,String friendif);

    @Modifying
    @Query(value = "UPDATE  tb_friend SET islike = ? WHERE userid = ? AND friendid = ?",nativeQuery = true)
    public void updateIslike(String islike,String userid,String friendid);

    @Modifying
    @Query(value = "DELETE FROM tb_friend WHERE userid = ? and friendid = ?",nativeQuery = true)
    void deleteFriend(String userId, String friendid);
}
